import React, { createContext, useContext } from 'react';

const NavigationContext = createContext();

export const useNavigation = () => {
    const context = useContext(NavigationContext);
    if (!context) {
        throw new Error('useNavigation must be used within NavigationProvider');
    }
    return context;
};

export const NavigationProvider = ({ children, onNavigate }) => {
    return (
        <NavigationContext.Provider value={{ onNavigate }}>
            {children}
        </NavigationContext.Provider>
    );
};

export default NavigationContext;
